home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 24
/
Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso
/
Aminet
/
disk
/
misc
/
Image2Disk.lha
/
Image2Disk
/
Image2Disk.s
< prev
next >
Wrap
Text File
|
1998-02-18
|
31KB
|
1,002 lines
*****************************************************************************
* *
* PROGRAM: Image2Disk *
* VERSION: 1.0 *
* SOURCE CODE: 7 *
* DATE: 13.01. - 20.01.1998 *
* LANGUAGE: Assembler (DevPac V3.14) *
* SYSTEM: A1200 KS 40.68 WB 40.42 2MB chip 8MB fast 68030/50mhz *
* *
* AUTHOR: Joerg Riemer 14167 Berlin/SchottmuellerStr.107/Germany *
* EMAIL: mission@cs.tu-berlin.de *
* *
* COMMENT: there are two assembler conditions. *
* *
* 1.) BSS_Section: To get a shorter File, don't assemble *
* with BSS-section. Use StripHunk instead to generate *
* a Code_BSS-segment. it spares some bytes! but for *
* anybody don't know what this means: "leave it as it is" *
* *
* StripHunk is available at AmiNet dev/misc/... *
* *
* 2.) Verify_On: image2disk has an option to verify *
* written tracks when using [image --> disk]. if *
* this condition is set, track-verifying will be *
* executed by default. otherwise the flag must be *
* set by user. *
* *
* for suggestions, hints/tips, and/or questions *
* send an email to: mission@cs.tu-berlin.de *
* *
*****************************************************************************
BSS_Section set 1
Verify_On set 0
*****************************************************************************
output ram:Image2Disk
************************************************ exec definitions ***********
_LVOWaitPort equ -384
_LVOGetMsg equ -372
_LVOForbid equ -132
_LVOReplyMsg equ -378
_LVOOpenLibrary equ -552
_LVOCloseLibrary equ -414
_LVOOpenDevice equ -444
_LVOCloseDevice equ -450
_LVODoIO equ -456
_LVOCreateIORequest equ -654
_LVODeleteIORequest equ -660
_LVOCreateMsgPort equ -666
_LVODeleteMsgPort equ -672
pr_CLI equ $0AC
pr_MsgPort equ $05C
IOSTD_SIZE equ $030
************************************************ dos definitions ************
_LVOOpen equ -030
_LVOClose equ -036
_LVORead equ -042
_LVOWrite equ -048
_LVOSeek equ -066
_LVODeleteFile equ -072
_LVOLock equ -084
_LVOUnLock equ -090
_LVOCurrentDir equ -126
_LVOLockDosList equ -654
_LVOUnLockDosList equ -660
_LVOFindDosEntry equ -684
_LVOInhibit equ -726
OFFSET_END equ 001
OFFSET_BEGINNING equ -001
ACCESS_READ equ -002
LDF_READ equ $001
LDF_DEVICES equ $004
MODE_NEWFILE equ $3EE
MODE_OLDFILE equ $3ED
************************************************ reqtools definitions *******
_LVOrtAllocRequestA equ -030
_LVOrtFreeRequest equ -036
_LVOrtChangeReqAttrA equ -048
_LVOrtFileRequestA equ -054
_LVOrtEZRequestA equ -066
EZREQF_NORETURNKEY equ $001
EZREQF_CENTERTEXT equ $004
FREQF_PATGAD equ $010
FREQF_SAVE equ $002
rtfi_Dir equ $010
RT_TagBase equ $80000000
RTEZ_ReqTitle equ RT_TagBase+20
RTEZ_Flags equ RT_TagBase+22
RTFI_Flags equ RT_TagBase+40
RTFI_Dir equ RT_TagBase+50
RTFI_MatchPat equ RT_TagBase+51
************************************************ bss datas ******************
WBMsg rs.l 1 ;workbench message
DOSBase rs.l 1 ;ptr. base of dos
REQBase rs.l 1 ;ptr. base of reqtools
RCode rs.l 1 ;buffer for returncode
DLock rs.l 1 ;buffer (returned dir.-lock)
FLock rs.l 1 ;buffer (opened file_lock)
ToDo rs.l 1 ;ptr. (subroutine to do)
TList rs.l 1 ;ptr. taglist
ReqTitle rs.l 1 ;ptr. (title for filereq.)
MessagePort rs.l 1 ;ptr. msgport for doio()
IORequest rs.l 1 ;ptr. iorequest for doio()
FReqBase rs.l 1 ;ptr. (base of filerequester)
ArgArray1 rs.l 1 ;reqtools argarray
ArgArray2 rs.l 0 ;ptr. to devicename
Device rs.l 1 ;sometimes used for argarray
FileName rs.b 108 :room for filename
EFlag rs.b 1 ;error flag
DriveNum rs.b 1 ;buffer (unit number)
DriveChr rs.b 1 ;buffer for "D","F","H","V"
RWSwitch rs.b 1 ;flag (read or write track)
VFlag rs.b 1 ;verify-switch
rs.b 1 ;unused (for longword align)
rs.b 1 ;unused (for longword align)
rs.b 1 ;unused (for longword align)
TrackBuffer1 rs.b 512*11*2 ;for read/write tracks
TrackBuffer2 rs.b 512*11*2 ;for verify written tracks
BSS_Size rs.b 0 ;bss_size overall
OneTrack set BSS_Size-TrackBuffer2 ;standard track_size
************************************************ workbench startup **********
Start movem.l D1-D7/A0-A6,-(SP) ;save registers
if BSS_Section ;check assembler condition
movea.l Start-4(pc),A5 ;get bss_section
addq.l #1,A5 ;skip pointer (next segment)
adda.l A5,A5 ;convert bpcl_pointer
adda.l A5,A5 ;to real_address
elseif ;otherwise
lea DataBase(pc),A5 ;set working area
endc ;end condition
*****************************************************************************
movea.l 4.w,A6 ;set execbase
movea.l $114(A6),A2 ;find own task
tst.l pr_CLI(A2) ;we are from cli?
bne.b FromCLI ;branch if so
lea pr_MsgPort(A2),A0 ;set message port
jsr _LVOWaitPort(A6) ;wait for
lea pr_MsgPort(A2),A0 ;set message port
jsr _LVOGetMsg(A6) ;get wb_message
move.l D0,(A5) ;and save for later return
*****************************************************************************
FromCLI bsr.b OpenLibs
*****************************************************************************
tst.l (A5) ;launched from wb?
beq.b ExitDOS ;branch if not
movea.l 4.w,A6 ;set execbase
jsr _LVOForbid(A6) ;use exec to (forbid) tasks
movea.l (A5),A1 ;set wb_message
jsr _LVOReplyMsg(A6) ;use EXEC to (replymsg)
ExitDOS move.l RCode(A5),D0 ;set returncode
movem.l (SP)+,D1-D7/A0-A6 ;restore registers
rts ;go back (shell/wb)
*****************************************************************************
version dc.b "$VER: image2disk 1.0 (20.1.98) by joerg riemer jan'98",0
************************************************ open libraries *************
OpenLibs moveq #20,D0 ;preset returncode
move.l D0,RCode(A5) ;20 - library not found!
moveq #37,D0 ;required library version
lea DOSName(pc),A1 ;set library name
jsr _LVOOpenLibrary(A6) ;use EXEC to (openlibrary)
move.l D0,DOSBase(A5) ;save base
beq.b CloseLibs ;branch if not open
moveq #38,D0 ;required library version
lea REQName(pc),A1 ;set library name
jsr _LVOOpenLibrary(A6) ;use EXEC to (openlibrary)
move.l D0,REQBase(A5) ;save base
beq.b CloseLibs ;branch if not open
*****************************************************************************
bsr.b Main
************************************************ close libraries ************
CloseLibs movea.l 4.w,A6 ;set EXEC to call a function
move.l REQBase(A5),D1 ;get base_ptr
beq.b CloseDOS ;branch when not open
movea.l D1,A1 ;set base_ptr
jsr _LVOCloseLibrary(A6) ;use EXEC to (closelibrary)
CloseDOS move.l DOSBase(A5),D1 ;get base_ptr
beq.b QuitClose ;branch when not open
movea.l D1,A1 ;set base_ptr
jsr _LVOCloseLibrary(A6) ;use EXEC to (closelibrary)
QuitClose rts ;back to DOS
*****************************************************************************
DOSName dc.b "dos.library",0
REQName dc.b "reqtools.library",0,0
*****************************************************************************
Main moveq #0,D0 ;preset returncode
move.l D0,RCode(A5) ;00 - everything ok!
bsr AllocReq ;allocate file_requester
bsr InitReq ;change some attributes
bsr.b SetDevChr ;set device_characters
************************************************
if Verify_On ;check assembler condition
bsr.b Verify ;verify -> default = vflag on
elseif ;otherwise
bsr.b Loop ;loop -> default = vflag off
endc ;end condition
************************************************
bsr FreeReq ;free file_requester
rts ;go back
************************************************ edit main requester text ***
SetDevChr moveq #3,D0 ;set loop_counter
lea ChrTable(pc),A0 ;set character table
lea Text22(pc),A1 ;set text to edit
SetChr move.l D0,D1 ;prepare text_offset
lsl #3,D1 ;prepare text_offset
add D0,D1 ;prepare text_offset
move.b 1(A0,D0.w),(A1,D1.w) ;edit requester text
dbra D